#ifndef __OLED_H
#define __OLED_H

#include "gd32f1x0.h"

#define  A0_H         GPIO_SetBits(GPIOB,GPIO_PIN_8)     //@ A0
#define  A0_L         GPIO_ResetBits(GPIOB,GPIO_PIN_8)   //@ A0

#define  CS_H         GPIO_SetBits(GPIOB,GPIO_PIN_7)     //@ CS
#define  CS_L         GPIO_ResetBits(GPIOB,GPIO_PIN_7)   //@ CS

#define  SCL_H		  GPIO_SetBits(GPIOF,GPIO_PIN_0)
#define  SCL_L        GPIO_ResetBits(GPIOF,GPIO_PIN_0)

#define  SDA_H        GPIO_SetBits(GPIOF,GPIO_PIN_1)
#define  SDA_L        GPIO_ResetBits(GPIOF,GPIO_PIN_1)

#define	G_1A	2
#define	G_1B	2
#define	G_1C	2
#define	G_1D	2
#define	G_1E	2
#define	G_1F	2
#define	G_1G	2
#define	G_2A	2
#define	G_2B	2
#define	G_2C	2
#define	G_2D	2
#define	G_2E	2
#define	G_2F	2
#define	G_2G	2
#define	G_3A	2
#define	G_3B	2
#define	G_3C	2
#define	G_3D	2
#define	G_3E	2
#define	G_3F	2
#define	G_3G	2
#define	G_4A	2
#define	G_4B	2
#define	G_4C	3
#define	G_4D	2
#define	G_4E	2
#define	G_4F	2
#define	G_4G	2
#define	G_5A	2
#define	G_5B	2
#define	G_5C	2
#define	G_5D	2
#define	G_5E	2
#define	G_5F	2
#define	G_5G	2
#define	G_6A	2
#define	G_6B	2
#define	G_6C	2
#define	G_6D	2
#define	G_6E	2
#define	G_6F	2
#define	G_6G	2
#define	G_7A	2
#define	G_7B	2
#define	G_7C	2
#define	G_7D	3
#define	G_7E	2
#define	G_7F	2
#define	G_7G	2
#define	G_8A	3
#define	G_8B	3
#define	G_8C	3
#define	G_8D	4
#define	G_8E	2
#define	G_8F	2
#define	G_8G	2
#define	G_P1	3
#define	G_P2	2
#define	G_S1	3
#define	G_S2	7
#define	G_S3	14
#define	G_S4	2
#define	G_S5	6
#define	G_S6	5
#define	G_S7	3
#define	G_S8	6
#define	G_S9	2
#define	G_S10	12
#define	G_S11	31
#define	G_S12	2
#define	G_S13	2
#define	G_S14	8
#define	G_S15	4
#define	G_S16	2
#define	G_S17	2
#define	G_S18	2
#define	G_S19	2
#define	G_S20	6
#define	G_S21	3
#define	G_S22	3
#define	G_S23	3
#define	G_S24	2
#define	G_S25	2
#define	G_R	    0
#define	G_G  	0







#define	GG_1A	4
#define	GG_1B	4
#define	GG_1C	4
#define	GG_1D	4
#define	GG_1E	4
#define	GG_1F	4
#define	GG_1G	4
#define	GG_2A	4
#define	GG_2B	4
#define	GG_2C	4
#define	GG_2D	4
#define	GG_2E	4
#define	GG_2F	4
#define	GG_2G	4
#define	GG_3A	4
#define	GG_3B	4
#define	GG_3C	4
#define	GG_3D	4
#define	GG_3E	4
#define	GG_3F	4
#define	GG_3G	4
#define	GG_4A	4
#define	GG_4B	4
#define	GG_4C	4
#define	GG_4D	4
#define	GG_4E	4
#define	GG_4F	4
#define	GG_4G	4
#define	GG_5A	4
#define	GG_5B	4
#define	GG_5C	4
#define	GG_5D	4
#define	GG_5E	4
#define	GG_5F	4
#define	GG_5G	4
#define	GG_6A	4
#define	GG_6B	4
#define	GG_6C	4
#define	GG_6D	4
#define	GG_6E	4
#define	GG_6F	4
#define	GG_6G	4
#define	GG_7A	4
#define	GG_7B	4
#define	GG_7C	4
#define	GG_7D	6
#define	GG_7E	4
#define	GG_7F	4
#define	GG_7G	4
#define	GG_8A	4
#define	GG_8B	4
#define	GG_8C	4
#define	GG_8D	6
#define	GG_8E	4
#define	GG_8F	4
#define	GG_8G	4
#define	GG_P1	4
#define	GG_P2	3
#define	GG_S1	4
#define	GG_S2	5
#define	GG_S3	10
#define	GG_S4	3
#define	GG_S5	6
#define	GG_S6	5
#define	GG_S7	4
#define	GG_S8	5
#define	GG_S9	3
#define	GG_S10	11
#define	GG_S11	29
#define	GG_S12	4
#define	GG_S13	4
#define	GG_S14	11
#define	GG_S15	6
#define	GG_S16	4
#define	GG_S17	4
#define	GG_S18	4
#define	GG_S19	4
#define	GG_S20	5
#define	GG_S21	4
#define	GG_S22	4
#define	GG_S23	4
#define	GG_S24	4
#define	GG_S25	4
#define	GG_R  	0
#define	GG_G	0




#define	GGG_1A	8
#define	GGG_1B	8
#define	GGG_1C	8
#define	GGG_1D	8
#define	GGG_1E	8
#define	GGG_1F	8
#define	GGG_1G	8
#define	GGG_2A	8
#define	GGG_2B	8
#define	GGG_2C	8
#define	GGG_2D	8
#define	GGG_2E	8
#define	GGG_2F	8
#define	GGG_2G	8
#define	GGG_3A	8
#define	GGG_3B	8
#define	GGG_3C	8
#define	GGG_3D	8
#define	GGG_3E	8
#define	GGG_3F	8
#define	GGG_3G	8
#define	GGG_4A	8
#define	GGG_4B	8
#define	GGG_4C	8
#define	GGG_4D	8
#define	GGG_4E	8
#define GGG_4F	8
#define	GGG_4G	8
#define	GGG_5A	6
#define	GGG_5B	6
#define	GGG_5C	6
#define	GGG_5D	6
#define	GGG_5E	6
#define	GGG_5F	6
#define	GGG_5G	6
#define	GGG_6A	6
#define	GGG_6B	6
#define	GGG_6C	6
#define	GGG_6D	6
#define	GGG_6E	6
#define	GGG_6F	6
#define	GGG_6G	6
#define	GGG_7A	6
#define	GGG_7B	6
#define	GGG_7C	6
#define	GGG_7D	8
#define	GGG_7E	6
#define	GGG_7F	6
#define	GGG_7G	6
#define	GGG_8A	6
#define	GGG_8B	6
#define	GGG_8C	6
#define	GGG_8D	8
#define	GGG_8E	6
#define	GGG_8F	6
#define	GGG_8G	6
#define	GGG_P1	6
#define	GGG_P2	5
#define	GGG_S1	6
#define	GGG_S2	7
#define	GGG_S3	12
#define	GGG_S4	4
#define	GGG_S5	8
#define	GGG_S6	7
#define	GGG_S7	6
#define	GGG_S8	7
#define	GGG_S9	5
#define	GGG_S10	13
#define	GGG_S11	29
#define	GGG_S12	7
#define	GGG_S13	7
#define	GGG_S14	13
#define	GGG_S15	10
#define	GGG_S16	6
#define	GGG_S17	6
#define	GGG_S18	6
#define	GGG_S19	6
#define	GGG_S20	7
#define	GGG_S21	6
#define	GGG_S22	6
#define	GGG_S23	6
#define	GGG_S24	6
#define	GGG_S25	6
#define	GGG_R	0
#define	GGG_G	0









#define  POSITION_1    1
#define  POSITION_2    2
#define  POSITION_3    3
#define  POSITION_4    4
#define  POSITION_5    5
#define  POSITION_6    6
#define  POSITION_7    7
#define  POSITION_8    8

#define  NUM_0    0
#define  NUM_1    1
#define  NUM_2    2
#define  NUM_3    3
#define  NUM_4    4
#define  NUM_5    5
#define  NUM_6    6
#define  NUM_7    7
#define  NUM_8    8
#define  NUM_9    9
#define  NUM_10   10
#define  NUM_11   11
#define  NUM_12   12
#define  NUM_13   13
#define  NUM_14   14
#define  NUM_15   15
#define  NUM_16   16
#define  NUM_17   17
#define  NUM_18   18
#define  NUM_19   19
#define  NUM_20   20
#define  NUM_21   21
#define  NUM_22   22
#define  NUM_23   23

#define  NUM_255  255



void send_buf_icom(unsigned char sw,const unsigned int *V,const unsigned int *VV,const unsigned int *VVV);
void send_buf_icom_RX(unsigned char sw,const unsigned int *V,const unsigned int *VV,const unsigned int *VVV);



void send_buf_num_sw(unsigned char position,unsigned char num);

void disp_num_12345(unsigned short int num);
void disp_num_5678(unsigned short int num);
void disp_num_hex_1234(unsigned short int num);
void disp_num_141516(unsigned short int angle);
void disp_num_6789(unsigned short int angle);
void disp_num_z1_6789(unsigned short int num);
void disp_num_z2_10111213(unsigned short int num);
void disp_num_1234(unsigned short int num);
void disp_num_angle_5678(unsigned short int num);

void OLED_Init(void);


void Disp_RX_ON_ALL(void);
void Disp_RX_OFF_ALL(void);
void Clear_BUF(void);
void Disp_RX(void);
void Disp_Error(unsigned char e,unsigned char x);
void Disp_End(void);

extern unsigned char GS_Cache[384]; 

extern const unsigned int D_1A[3];
extern const unsigned int D_1B[3];
extern const unsigned int D_1C[3];
extern const unsigned int D_1D[3];
extern const unsigned int D_1E[3];
extern const unsigned int D_1F[3];
extern const unsigned int D_1G[3];

extern const unsigned int D_2A[3];
extern const unsigned int D_2B[3];
extern const unsigned int D_2C[3];
extern const unsigned int D_2D[3];
extern const unsigned int D_2E[3];
extern const unsigned int D_2F[3];
extern const unsigned int D_2G[3];

extern const unsigned int D_3A[3];
extern const unsigned int D_3B[3];
extern const unsigned int D_3C[3];
extern const unsigned int D_3D[3];
extern const unsigned int D_3E[3];
extern const unsigned int D_3F[3];
extern const unsigned int D_3G[3];

extern const unsigned int D_4A[3];
extern const unsigned int D_4B[3];
extern const unsigned int D_4C[3];
extern const unsigned int D_4D[3];
extern const unsigned int D_4E[3];
extern const unsigned int D_4F[3];
extern const unsigned int D_4G[3];

extern const unsigned int D_5A[3];
extern const unsigned int D_5B[3];
extern const unsigned int D_5C[3];
extern const unsigned int D_5D[3];
extern const unsigned int D_5E[3];
extern const unsigned int D_5F[3];
extern const unsigned int D_5G[3];

extern const unsigned int D_6A[3];
extern const unsigned int D_6B[3];
extern const unsigned int D_6C[3];
extern const unsigned int D_6D[3];
extern const unsigned int D_6E[3];
extern const unsigned int D_6F[3];
extern const unsigned int D_6G[3];

extern const unsigned int D_7A[3];
extern const unsigned int D_7B[3];
extern const unsigned int D_7C[3];
extern const unsigned int D_7D[3];
extern const unsigned int D_7E[3];
extern const unsigned int D_7F[3];
extern const unsigned int D_7G[3];

extern const unsigned int D_8A[3];
extern const unsigned int D_8B[3];
extern const unsigned int D_8C[3];
extern const unsigned int D_8D[3];
extern const unsigned int D_8E[3];
extern const unsigned int D_8F[3];
extern const unsigned int D_8G[3];

extern const unsigned int D_S1[3];
extern const unsigned int D_S2[3];
extern const unsigned int D_S3[3];
extern const unsigned int D_S4[3];
extern const unsigned int D_S5[3];
extern const unsigned int D_S6[3];
extern const unsigned int D_S7[3];
extern const unsigned int D_S8[3];
extern const unsigned int D_S9[3];
extern const unsigned int D_S10[3];
extern const unsigned int D_S11[3];
extern const unsigned int D_S12[3];
extern const unsigned int D_S13[3];
extern const unsigned int D_S14[3];
extern const unsigned int D_S15[3];
extern const unsigned int D_S16[3];
extern const unsigned int D_S17[3];
extern const unsigned int D_S18[3];
extern const unsigned int D_S19[3];
extern const unsigned int D_S20[3];
extern const unsigned int D_S21[3];
extern const unsigned int D_S22[3];
extern const unsigned int D_S23[3];
extern const unsigned int D_S24[3];
extern const unsigned int D_S25[3];

extern const unsigned int D_P1[3];
extern const unsigned int D_P2[3];

extern const unsigned int D_G[3];
extern const unsigned int D_R[3];


extern const unsigned int DD_1A[3];
extern const unsigned int DD_1B[3];
extern const unsigned int DD_1C[3];
extern const unsigned int DD_1D[3];
extern const unsigned int DD_1E[3];
extern const unsigned int DD_1F[3];
extern const unsigned int DD_1G[3];

extern const unsigned int DD_2A[3];
extern const unsigned int DD_2B[3];
extern const unsigned int DD_2C[3];
extern const unsigned int DD_2D[3];
extern const unsigned int DD_2E[3];
extern const unsigned int DD_2F[3];
extern const unsigned int DD_2G[3];

extern const unsigned int DD_3A[3];
extern const unsigned int DD_3B[3];
extern const unsigned int DD_3C[3];
extern const unsigned int DD_3D[3];
extern const unsigned int DD_3E[3];
extern const unsigned int DD_3F[3];
extern const unsigned int DD_3G[3];

extern const unsigned int DD_4A[3];
extern const unsigned int DD_4B[3];
extern const unsigned int DD_4C[3];
extern const unsigned int DD_4D[3];
extern const unsigned int DD_4E[3];
extern const unsigned int DD_4F[3];
extern const unsigned int DD_4G[3];

extern const unsigned int DD_5A[3];
extern const unsigned int DD_5B[3];
extern const unsigned int DD_5C[3];
extern const unsigned int DD_5D[3];
extern const unsigned int DD_5E[3];
extern const unsigned int DD_5F[3];
extern const unsigned int DD_5G[3];

extern const unsigned int DD_6A[3];
extern const unsigned int DD_6B[3];
extern const unsigned int DD_6C[3];
extern const unsigned int DD_6D[3];
extern const unsigned int DD_6E[3];
extern const unsigned int DD_6F[3];
extern const unsigned int DD_6G[3];

extern const unsigned int DD_7A[3];
extern const unsigned int DD_7B[3];
extern const unsigned int DD_7C[3];
extern const unsigned int DD_7D[3];
extern const unsigned int DD_7E[3];
extern const unsigned int DD_7F[3];
extern const unsigned int DD_7G[3];

extern const unsigned int DD_8A[3];
extern const unsigned int DD_8B[3];
extern const unsigned int DD_8C[3];
extern const unsigned int DD_8D[3];
extern const unsigned int DD_8E[3];
extern const unsigned int DD_8F[3];
extern const unsigned int DD_8G[3];

extern const unsigned int DD_S1[3];
extern const unsigned int DD_S2[3];
extern const unsigned int DD_S3[3];
extern const unsigned int DD_S4[3];
extern const unsigned int DD_S5[3];
extern const unsigned int DD_S6[3];
extern const unsigned int DD_S7[3];
extern const unsigned int DD_S8[3];
extern const unsigned int DD_S9[3];
extern const unsigned int DD_S10[3];
extern const unsigned int DD_S11[3];
extern const unsigned int DD_S12[3];
extern const unsigned int DD_S13[3];
extern const unsigned int DD_S14[3];
extern const unsigned int DD_S15[3];
extern const unsigned int DD_S16[3];
extern const unsigned int DD_S17[3];
extern const unsigned int DD_S18[3];
extern const unsigned int DD_S19[3];
extern const unsigned int DD_S20[3];
extern const unsigned int DD_S21[3];
extern const unsigned int DD_S22[3];
extern const unsigned int DD_S23[3];
extern const unsigned int DD_S24[3];
extern const unsigned int DD_S25[3];

extern const unsigned int DD_P1[3];
extern const unsigned int DD_P2[3];

extern const unsigned int DD_G[3];
extern const unsigned int DD_R[3];



extern const unsigned int DDD_1A[3];;
extern const unsigned int DDD_1B[3];
extern const unsigned int DDD_1C[3];
extern const unsigned int DDD_1D[3];
extern const unsigned int DDD_1E[3];
extern const unsigned int DDD_1F[3];
extern const unsigned int DDD_1G[3];

extern const unsigned int DDD_2A[3];
extern const unsigned int DDD_2B[3];
extern const unsigned int DDD_2C[3];
extern const unsigned int DDD_2D[3];
extern const unsigned int DDD_2E[3];
extern const unsigned int DDD_2F[3];
extern const unsigned int DDD_2G[3];

extern const unsigned int DDD_3A[3];
extern const unsigned int DDD_3B[3];
extern const unsigned int DDD_3C[3];
extern const unsigned int DDD_3D[3];
extern const unsigned int DDD_3E[3];
extern const unsigned int DDD_3F[3];
extern const unsigned int DDD_3G[3];

extern const unsigned int DDD_4A[3];
extern const unsigned int DDD_4B[3];
extern const unsigned int DDD_4C[3];
extern const unsigned int DDD_4D[3];
extern const unsigned int DDD_4E[3];
extern const unsigned int DDD_4F[3];
extern const unsigned int DDD_4G[3];

extern const unsigned int DDD_5A[3];
extern const unsigned int DDD_5B[3];
extern const unsigned int DDD_5C[3];
extern const unsigned int DDD_5D[3];
extern const unsigned int DDD_5E[3];
extern const unsigned int DDD_5F[3];
extern const unsigned int DDD_5G[3];

extern const unsigned int DDD_6A[3];
extern const unsigned int DDD_6B[3];
extern const unsigned int DDD_6C[3];
extern const unsigned int DDD_6D[3];
extern const unsigned int DDD_6E[3];
extern const unsigned int DDD_6F[3];
extern const unsigned int DDD_6G[3];

extern const unsigned int DDD_7A[3];
extern const unsigned int DDD_7B[3];
extern const unsigned int DDD_7C[3];
extern const unsigned int DDD_7D[3];
extern const unsigned int DDD_7E[3];
extern const unsigned int DDD_7F[3];
extern const unsigned int DDD_7G[3];

extern const unsigned int DDD_8A[3];
extern const unsigned int DDD_8B[3];
extern const unsigned int DDD_8C[3];
extern const unsigned int DDD_8D[3];
extern const unsigned int DDD_8E[3];
extern const unsigned int DDD_8F[3];
extern const unsigned int DDD_8G[3];

extern const unsigned int DDD_S1[3];
extern const unsigned int DDD_S2[3];
extern const unsigned int DDD_S3[3];
extern const unsigned int DDD_S4[3];
extern const unsigned int DDD_S5[3];
extern const unsigned int DDD_S6[3];
extern const unsigned int DDD_S7[3];
extern const unsigned int DDD_S8[3];
extern const unsigned int DDD_S9[3];
extern const unsigned int DDD_S10[3];
extern const unsigned int DDD_S11[3];
extern const unsigned int DDD_S12[3];
extern const unsigned int DDD_S13[3];
extern const unsigned int DDD_S14[3];
extern const unsigned int DDD_S15[3];
extern const unsigned int DDD_S16[3];
extern const unsigned int DDD_S17[3];
extern const unsigned int DDD_S18[3];
extern const unsigned int DDD_S19[3];
extern const unsigned int DDD_S20[3];
extern const unsigned int DDD_S21[3];
extern const unsigned int DDD_S22[3];
extern const unsigned int DDD_S23[3];
extern const unsigned int DDD_S24[3];
extern const unsigned int DDD_S25[3];

extern const unsigned int DDD_P1[3];
extern const unsigned int DDD_P2[3];

extern const unsigned int DDD_G[3];
extern const unsigned int DDD_R[3];



#endif






